﻿using Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Utility;
using System.Utility.DBMS;
using System.Utility.Messaging;
using System.Utility.UI;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebUI.Classes;

namespace WebUI
{
    public partial class addlisting : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
                try
                {
                    AppUser usr = StateManager<AppUser>.GetSessionState(SessionKey.UserInfo);

                    object[] arr = new object[]{
                    post_title.Value,post_desc.Value,post_tags.Value,gd_placecategory.Items[gd_placecategory.SelectedIndex].Value,
                    post_address.Value,post_country.Items[post_country.SelectedIndex].Value,city.Value,state.Value,post_zip.Value,
                    geodir_timing.Value,geodir_contact.Value,geodir_email.Value,geodir_website.Value,geodir_twitter.Value,geodir_facebook.Value,geodir_video.Value,
                    geodir_special_offers.Value,geodir_listing_guest_count.Value,geodir_listing_bedroom_count.Value,geodir_listing_bed_count.Value,
                    geodir_listing_price.Value,geodir_listing_start_date.Value,geodir_listing_end_date.Value,geodir_adult_count.Value,geodir_children_count.Value,
                    geodir_listing_type.Items[geodir_listing_type.SelectedIndex].Value,geodir_bathroom_count.Value            };

                    long id = long.Parse(DBHelper.GetDataTable("AddListing", new object[] { post_title.Value, post_desc.Value, usr.EmailId }).Tables[0].Rows[0][0].ToString());
                    Session["ListId"] = id;

                    Server.Transfer(Constant.Link.PinMapLink);
                }
                catch (Exception ex)
                {
                    MessageUtility.LogAndGetMessageCode(ex);
                    PageUtility.RegisterClientScriptBlockByMessageId(this, "GE0001");
                }
        }
    }
}